package com.bruan.regex;

public class RegexTest1 {
    public static void main(String[] args) {
        System.out.println(checkQQ(null));
        System.out.println(checkQQ("321321321"));
        System.out.println(checkQQ("dw123123"));
        System.out.println(checkQQ("0dwadw123"));
        System.out.println(checkQQ("023982131"));
        System.out.println("________________________________________");
        System.out.println(checkQQ1(null));
        System.out.println(checkQQ1("321321321"));
        System.out.println(checkQQ1("dw123123"));
        System.out.println(checkQQ1("0dwadw123"));
        System.out.println(checkQQ1("023982131"));
    }
    public static boolean checkQQ(String qq){
        if(qq==null||qq.startsWith("0")){
            return false;
        } else{
            for (int i = 0; i < qq.length(); i++) {
                char c = qq.charAt(i);
                if (c<'0'||c>'9'){
                    return false;
                }
            }
        }
        return true;
    }
    //正则表达式
    public static boolean checkQQ1(String qq){
        return qq!=null&&qq.matches("[1-9]\\d{5,19}");
    }
}
